NAME            = tst

CPU = msp430x1611
CC              = msp430-gcc
CFLAGS          = -Wall -mmcu=${CPU} -O0 -g 


SRCS		= main.c   myfunc.c

OBJECTS := $(SRCS:.c=.o)

all: ${NAME}.elf ${NAME}.lst


${NAME}.elf: ${OBJECTS}
	${CC} -mmcu=${CPU}  -o $@ ${OBJECTS} 


${NAME}.lst: ${NAME}.elf
	@msp430-objdump -dSt $^ >$@



# General compilation rule
%.o: %.c 
	@-printf "$(notdir $<) \033[1;33m --> \033[0m $@ \n"
	@$(CC) $(CFLAGS)  -c $< -o $@


%.e: %.c 
	@-printf "$(notdir $<) \033[1;33m --> \033[0m $@ \n"
	@$(CC) -E $(CFLAGS)  -c $< -o $@

clean:
	rm -f ${NAME}.elf ${NAME}.lst ${OBJECTS} .depend


depend: .depend
.depend: $(SRCS)
	@echo "Making depend with $(SRCS)"
	@$(CC) -E -MM $(CFLAGS) $(SRCS)   > .depend;

include .depend